package com.wc.alorithm_blue_bridge._简单题.Q3412;

import java.util.*;

/**
 * @Author congege
 * @Description 最小化战斗力
 * https://www.lanqiao.cn/problems/3412/learning/?page=1
 * @Date Created in 2023/11/23-21:17
 */
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = scan.nextInt();
        }
        Arrays.sort(array);
        int ans = Integer.MAX_VALUE;
        for (int i = 1; i < n; i++) {
            ans = Math.min(ans, array[i] - array[i - 1]);
        }
        System.out.println(ans);
        scan.close();
    }
}
